package org.example.fancystudy.basic;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chaigq
 * @version 1.0
 * @date 2023/9/19 10:09
 */
public class BasicTest1 {

    public void play() {
        System.out.println("Instrument is playing...");
    }

}
class Instrument1 extends BasicTest1 {
    @Override
    public void play() {
        System.out.println("Instrument1 is playing...");
    }
}

class Instrument2 extends BasicTest1 {
    @Override
    public void play() {
        System.out.println("Instrument2 is playing...");
    }
}

class Instrument4 {
    public static void main(String[] args) {
//        List<BasicTest1> list = new ArrayList();
//        list.add(new Instrument1());
//        list.add(new Instrument2());
//        for (BasicTest1 b : list) {
//            b.play();
//        }
        BigDecimal bd = new BigDecimal(1000.1);
        BigDecimal bd2 = new BigDecimal(1000);
        System.out.println("bd:"+bd.stripTrailingZeros().scale());
        System.out.println("bd2:"+bd2.stripTrailingZeros().scale());
        if (bd.stripTrailingZeros().scale() > 0){
            System.out.println("======bd非整数======");
        }
        if (bd2.stripTrailingZeros().scale() > 0){
            System.out.println("======bd2非整数======");
        }
    }
    //二分查找法
//    int ComNum_Binary(int a[],int lenA,int b[],int lenB,int comlst){
//        int i,j,k=0;
//        for(i = 0; i < lenA; i++)
//        {
//            int l=0,r=lenB-1,mid;
//            while(l <= r){
//                mid = (l+r)/2;
//                if( a[i] < b[mid] ) {
//                    r = mid - 1;
//                }else if( a[i] > b[mid] ) {
//                    l = mid + 1;
//                }else{
//                    comlst[k++] = a[i];
//                    break;
//                }
//            }
//        }
//        return k;
//    }
}
